package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstPosterDao;
import com.financing.wap.dto.DstPosterDTO;
import com.financing.wap.service.IDstPosterService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_poster  
 * 宣传海报 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstPosterService")
public class DstPosterServiceImpl implements IDstPosterService{

	@Autowired
	private IDstPosterDao dstPosterDao;

	@Override
	public int insert(DstPosterDTO dstPoster) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstPoster);
		DTOdateSetUtil.setUpdateInfo(dstPoster);
		dstPoster.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstPosterDao.insert(dstPoster);
	}

	@Override
	public void update(DstPosterDTO dstPoster) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstPoster);
		dstPosterDao.update(dstPoster);
	}

	@Override
	public void updateForce(DstPosterDTO dstPoster) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstPoster);
		dstPosterDao.updateForce(dstPoster);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstPosterDao.delete(id);
	}
	
	@Override
	public List<DstPosterDTO> queryList(DstPosterDTO dstPoster) throws SQLException {
		return dstPosterDao.queryList(dstPoster);
	}

	@Override
	public int queryListCount(DstPosterDTO dstPoster) throws SQLException {
		return dstPosterDao.queryListCount(dstPoster);
	}

	@Override
	public DstPosterDTO loadById(Integer id) throws SQLException {
		return dstPosterDao.loadById(id);
	}
 	@Override
	public DstPosterDTO queryListGetFirst(DstPosterDTO dstPoster)
			throws SQLException {
		 List<DstPosterDTO> queryList = queryList(dstPoster);
		 if(queryList==null||queryList.size()==0){
			 return new DstPosterDTO();
		 }
		 return queryList.get(0);
	}
}
